import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';

import '../../common/const/app_color_const.dart';
import '../../common/const/app_style_const.dart';
import '../../widget/dialog_container.dart';
import '../../widget/input_field.dart';

class LiveAuditDialog {
  static showLiveAuditRejectDialog(Function submitCb) {
    const tag = "liveAuditRejectDialogTag";
    TextEditingController reviewRemarkCtrl = TextEditingController();

    SmartDialog.compatible.show(
      tag: tag,
      backDismiss: false,
      clickBgDismissTemp: false,
      isLoadingTemp: false,
      widget: DialogContainer(
          dialogHeight: 250,
          dialogWidth: 320,
          dialogPadding: 15,
          dialogHeaderCloseBtn: false,
          dialogHeaderBorderColor: transparentColor1,
          dialogFooterBorderColor: transparentColor1,
          dialogTitle: '拒绝',
          onDialogClose: () {
            SmartDialog.dismiss(tag: tag);
          },
          dialogBodyBuilder: (context) => Container(
                alignment: Alignment.topLeft,
                padding: const EdgeInsets.only(top: 5, bottom: 10),
                child: InputField(
                  controller: reviewRemarkCtrl,
                  inputFormatters: [LengthLimitingTextInputFormatter(300)],
                  maxLines: 8,
                  minLines: 8,
                  hintText: '请输入拒绝理由',
                  labelText: '拒绝理由',
                ),
              ),
          dialogFooterBuilder: (context) => Row(
                mainAxisAlignment: MainAxisAlignment.end,
                crossAxisAlignment: CrossAxisAlignment.end,
                children: [
                  TextButton(
                    onPressed: () {
                      submitCb(reviewRemarkCtrl.text,
                          () => SmartDialog.dismiss(tag: tag));
                    },
                    child: const Text("提交"),
                  ),
                  TextButton(
                    onPressed: () {
                      SmartDialog.dismiss(tag: tag);
                    },
                    style: cancelBtnStyle,
                    child: const Text("取消"),
                  ),
                ],
              )),
    );
  }
}
